package net.lab0.google.ex2;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Ex2
{
    public static void main(String[] args)
    {
        System.out.println("start");
        Scanner scanner = new Scanner(System.in);
        int tests = scanner.nextInt();
        scanner.nextLine();
        
        for (int i = 0; i < tests; ++i)
        {
            int googlersCount = scanner.nextInt();
            int surprising = scanner.nextInt(); // surprising = can cheat to have a big enough score
            int score = scanner.nextInt();
            List<Integer> googlersList = new ArrayList<>(googlersCount);
            for (int j = 0; j < googlersCount; ++j)
            {
                googlersList.add(scanner.nextInt());
            }
            
            int max = getMaxCountOfSuccessfulGooglers(surprising, score, googlersList);
            
            System.out.println("Case #" + (i + 1) + ": " + max);
        }
    }
    
    private static int getMaxCountOfSuccessfulGooglers(int surprising, int score, List<Integer> googlersList)
    {
        int max = 0;
        
        for (int i : googlersList)
        {
            int rest = i - score; // we try to have the highest score
            
            // if the rest is negative -> impossible score anyway
            if (rest < 0)
            {
                continue;
            }
            
            if (rest >= (score-1) * 2)
            {
                // we are sure to have enough points
                max++;
                continue;
            }
            
            int n1 = rest / 2; // this is the lowest value of the triplet with the wanted score
            
            // if the gap between the lowest and the highest scores is >2 -> impossible
            int gap = Math.abs(score - n1);
            if (gap > 2)
            {
                continue;
            }
            else if (gap == 2) // cheat
            {
                if (surprising > 0) // try to cheat
                {
                    surprising--; // 1 lets possibility to cheat
                    max++; // but 1 more winner
                }
            }
            else if (gap <= 1)
            {
                max++;
            }
        }
        
        return max;
    }
}

/*
 * 
 * n rest = n - score n2 = rest/2 n3 = rest/2 + rest%2
 */
